﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Awsc.DataAcquisitionSys.Core.Migrations
{
    /// <inheritdoc />
    public partial class Init : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "AlarmRules",
                columns: table => new
                {
                    Id = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    Status = table.Column<int>(type: "INTEGER", nullable: false),
                    Level = table.Column<int>(type: "INTEGER", nullable: false),
                    RuleType = table.Column<int>(type: "INTEGER", nullable: false),
                    IsBuildIn = table.Column<bool>(type: "INTEGER", nullable: false),
                    AlarmMethods = table.Column<string>(type: "TEXT", nullable: false),
                    Condition = table.Column<string>(type: "TEXT", nullable: true),
                    Description = table.Column<string>(type: "TEXT", nullable: true),
                    Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AlarmRules", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Missions",
                columns: table => new
                {
                    Id = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    ManagerName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    Remarks = table.Column<string>(type: "TEXT", nullable: true),
                    TeamID = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    Unit = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    Location = table.Column<string>(type: "TEXT", nullable: true),
                    ConstructionLocation = table.Column<string>(type: "TEXT", nullable: true),
                    WellDeep = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    ManulBottomHole = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    FillTime = table.Column<DateTime>(type: "TEXT", nullable: true),
                    WellMode = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    WellType = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    DesignLayer = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    CurrentLayer = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    WorkType = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    DeviceMode = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    WorkingProcedure = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    WellParkerMode = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    BopConfiguration = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    LatestPresureTest = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    CreateTime = table.Column<DateTime>(type: "TEXT", nullable: true),
                    LatestPresureTestTime = table.Column<DateTime>(type: "TEXT", nullable: true),
                    FinishTime = table.Column<DateTime>(type: "TEXT", nullable: true),
                    Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Missions", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Sentinels",
                columns: table => new
                {
                    Id = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    StartTime = table.Column<DateTime>(type: "TEXT", nullable: true),
                    EndTime = table.Column<DateTime>(type: "TEXT", nullable: true),
                    Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sentinels", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "WearParts",
                columns: table => new
                {
                    Id = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    Description = table.Column<string>(type: "TEXT", nullable: true),
                    Status = table.Column<int>(type: "INTEGER", nullable: false),
                    LastMaintenanceDate = table.Column<DateTime>(type: "TEXT", nullable: true),
                    UsageCount = table.Column<double>(type: "REAL", nullable: false),
                    FactoryCount = table.Column<double>(type: "REAL", nullable: false),
                    Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WearParts", x => x.Id);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AlarmRules");

            migrationBuilder.DropTable(
                name: "Missions");

            migrationBuilder.DropTable(
                name: "Sentinels");

            migrationBuilder.DropTable(
                name: "WearParts");
        }
    }
}
